<script lang="ts" setup name="Playground">
import { ref } from 'vue'
import { useIntersectionObserver } from '@vueuse/core'
const target = ref<HTMLImageElement | null>(null)
const { stop } = useIntersectionObserver(target, ([{ isIntersecting }], document) => {
  console.log('执行了', isIntersecting, document);
  if (isIntersecting) {
    target.value!.src = 'https://yjy-oss-files.oss-cn-zhangjiakou.aliyuncs.com/tuxian/popular_1.jpg'
    stop()
  }
})
</script>
<template>
  <div style="height:3000px"></div>
  <img ref="target" alt="">
  <!-- <img src="https://yjy-oss-files.oss-cn-zhangjiakou.aliyuncs.com/tuxian/popular_1.jpg" alt=""> -->
</template>
<style lang="less" scoped></style>